<?php
	function accept($_GET)
		{
			$sql = new db();
			$req = "UPDATE offre_transport SET Etat='A' WHERE Id_Commande=".$_GET['idcom']." AND GLN_Transporteur=".$_GET['glntr'];
			$sql->query($req);
			$req = "UPDATE offre_transport SET Etat='R' WHERE Id_Commande=".$_GET['idcom']." AND GLN_Transporteur != ".$_GET['glntr'];
			$sql->query($req);
			$req = "UPDATE proposition_affretement SET GLN_Transporteur =".$_GET['glntr']." WHERE Id_Commande=".$_GET['idcom'];
			$sql->query($req);
			header("location:".ABS_PATH.ROOT."?page=Usine/ShowCom&fct=Usine/ShowCom&idcom=".$_GET['idcom']);		
		}
		
	function refus($_GET)
		{
			$sql = new db();
			$req = "UPDATE offre_transport SET Etat='R' WHERE Id_Commande=".$_GET['idcom']." AND GLN_Transporteur=".$_GET['glntr'];
			$sql->query($req);
			header("location:".ABS_PATH.ROOT."?page=Usine/ShowCom&fct=Usine/ShowCom&idcom=".$_GET['idcom']);
		}
	if ($_GET['act'] == "accept")
		accept($_GET);
	else if ($_GET['act'] == "refus")
		refus($_GET);
?>